﻿using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;

namespace BLL.Services.Messages.Listing
{
    public class ListingUserMessage
    {

        public ListingUserMessage()
        {
             Messages = new List<ListingMessage>(); 
             Filter = new ListingUserMessageFilter();
        }

        public List<ListingMessage> Messages { get; set; }

        public int Page { get; set; }

        public int TotalPages { get; set; }

        public int Size { get; set; }

        public int Direction { get; set; }

        public string Column { get; set; }

        public ListingUserMessageFilter Filter { get; set; }

        public class ListingMessage
        {
            [UIHint("hidden")]
            public int UserId { get; set; }

            [Display(Name = "Avatar")]
            public string Avatar { get; set; }

            [Display(Name = "Login")]
            public string Login { get; set; }

            [Display(Name = "Message")]
            public string Message { get; set; }

            [Display(Name = "Date Of Send")]
            public DateTime DateOfSend { get; set; }

            [Display(Name = "Date Of Read")]
            public DateTime? DateOfRead { get; set; }

            public string DateOfReadToString
            {
                get
                {
                    return DateOfRead != null ? DateOfRead.Value.ToString() : "Сообщение не прочитанно!!!";
                }
            }

            public string DateOfSendToString
            {
                get
                {
                    return DateOfSend.ToString();
                }
            }

        }
    }
}